using UnityEngine;
using System.Collections;

public class SceneMenu : AndroidMenu 
{
	public Transform audioPrefab;
	
	void Start()
	{
		base._manager = gameObject.GetComponent<MenuManager>();
		base.amount = _manager.amount;
		
				
		if(GameObject.Find("AudioBehavior"))
			Destroy(GameObject.Find("AudioBehavior"));
		
		gameObject.AddComponent("InputManager");
	}

	void OnTouchOver(GameObject go)
	{
		if(!go.GetComponent<SpecialCube>() && ready)
			go.AddComponent("SpecialCube");
	}
	
	void OnTouchExit(GameObject go)
	{
		if(go.GetComponent<SpecialCube>() && ready)
			Destroy(go.GetComponent<SpecialCube>());
		
		go.renderer.material.color = Color.white;
	}
	
	void OnTouchUp(GameObject go)
	{
		if(ready)
		{
			switch(go.name)
			{
				case "_Begin":

						if(PlayerPrefs.GetString("Tutorial").Equals("Off"))
						_manager.changeScene("Selecao");
				
						else
						{
						Transform a = Instantiate(audioPrefab,Camera.mainCamera.transform.position,Camera.mainCamera.transform.rotation) as Transform;
						a.name = "AudioBehavior";
						_manager.changeScene("Tutorial");
						}
		
					break;
				
				case "_Achievements":
					_manager.changeScene(go.name);
					break;
				
				case "_Options":
					_manager.changeScene(go.name);
					break;
			}
	
		}
	}
	
	void Ready()
	{
		ready = true;
	}
}
	